@extends('admin_system/public/angular-layout')
<body ng-app="admin-app" ng-controller="chapterController">
<div class="main-container" data-ng-init="get_prisidentInfo()">

    {{--顶部导航--}}
    <div class="col-xs-12 top-nav nav">
        <p class="float-left nav-path"><strong>当前位置：</strong>分会管理>>添加、编辑会长</p>

        {{--返回按钮--}}
        <button type="button" class="btn btn-default float-right back" aria-label="Left Align">
            <span class="glyphicon glyphicon-arrow-left back" aria-hidden="true"></span>
            <span>返回</span>
        </button>
    </div>

    <div class="h10 col-xs-12"></div>

    {{--正文内容--}}
    <div class="content-box col-xs-12 mt20 pb20 pt20">
        <form class="col-xs-4" style="min-width: 300px;" action="{{asset('/admin_system/chapter/update_prisident')}}" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label>分会名称：</label>
                <input  class="form-control" ng-model="prisidentInfo.chapterName" disabled>
            </div>

            <div class="form-group">
                <label>会长：</label>
                <input class="form-control" ng-model="prisidentInfo.prisidentName" readonly onclick="$('#model').modal('show');" id="prisidentName">
                <input style="position: fixed;left:-200vw;" ng-model="prisidentInfo.user_id" id="prisidentId">
            </div>


            <div class="form-group">
                <label>会长类型：</label>
                <select name="prisident_type" class="form-control" ng-model="prisidentInfo.prisident_type">
                    <option value="">请选择</option>
                    <option value="Z">发起人</option>
                    <option value="F">会长</option>
                </select>
            </div>


            <div class="form-group">
                <label>总金额：</label>
                <input name="total_money" class="form-control" ng-model="prisidentInfo.total_money" required>
            </div>

            <div class="form-group">
                <label>已支付金额：</label>
                <input name="payed_money" class="form-control" ng-model="prisidentInfo.payed_money" required>
            </div>

            <div class="form-group">
                <label>剩余金额：</label>
                <input class="form-control" ng-model="prisidentInfo.surplus_money" required>
            </div>


            <span  class="btn btn-primary" ng-click="update_prisident_info()">提交</span>
        </form>
    </div>

    <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="model">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="gridSystemModalLabel">选择用户</h4>
                </div>


                <div class="modal-body">
                    <iframe src="{{asset('admin_system/member/select_member?callback=receive_member')}}" frameborder="0" style="width:100%;height:80vh;"></iframe>
                </div>
            </div>
        </div>
    </div>


    <script>
        function receive_member(members){
            $('#model').modal('hide');
            for(member of members){
                $('#prisidentName').val(member.name);
                $('#prisidentId').val(member.id);

                $('#prisidentId').trigger('input');
                $('#prisidentId').trigger('change');
                $('#prisidentName').trigger('input');
                $('#prisidentName').trigger('change');
                break;
            }
        }
    </script>
</div>
</body>

